/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
 * Description: notify resource pool
 */

#include "notify_pool.h"
#include "notify_pool_impl.h"

namespace hccl {
NotifyPool::NotifyPool()
{
}

NotifyPool::~NotifyPool()
{
    pimpl_ = nullptr;
}


HcclResult NotifyPool::Init(const s32 devicePhyId)
{
    pimpl_.reset((new (std::nothrow) NotifyPoolImpl(devicePhyId)));
    CHK_SMART_PTR_NULL(pimpl_);
    return pimpl_->Init();
}

HcclResult NotifyPool::Destroy()
{
    CHK_SMART_PTR_NULL(pimpl_);
    return pimpl_->Destroy();
}

HcclResult NotifyPool::RegisterOp(const std::string &tag)
{
    CHK_SMART_PTR_NULL(pimpl_);
    return pimpl_->RegisterOp(tag);
}

HcclResult NotifyPool::UnregisterOp(const std::string &tag)
{
    CHK_SMART_PTR_NULL(pimpl_);
    return pimpl_->UnregisterOp(tag);
}

HcclResult NotifyPool::Alloc(const std::string &tag, const RemoteRankInfo &info,
    std::shared_ptr<LocalIpcNotify> &localNotify, const NotifyLoadType type)
{
    CHK_SMART_PTR_NULL(pimpl_);
    return pimpl_->Alloc(tag, info, type, localNotify);
}

HcclResult NotifyPool::ResetNotify()
{
    CHK_SMART_PTR_NULL(pimpl_);
    return pimpl_->ResetNotify();
}

HcclResult NotifyPool::ResetNotifyForDestRank(s64 destRank)
{
    CHK_SMART_PTR_NULL(pimpl_);
    return pimpl_->ResetNotifyForDestRank(destRank);
}
}  // namespace hccl
